<%@page import="com.skali.portlet.governmentSpending.service.model.SpendingType"%>
<%@page import="com.skali.portlet.governmentSpending.service.service.SpendingTypeLocalServiceUtil"%>
<%@ include file="/html/portlet/governmentspending/init.jsp" %>
test


<%
PortletURL tab1URL = renderResponse.createRenderURL();
tab1URL.setWindowState(WindowState.NORMAL);
tab1URL.setParameter("tabs1", "Spending-Type");

String TypeId = renderRequest.getParameter("spendingTypeId");
boolean isAddType = Boolean.valueOf(renderRequest.getParameter("addType"));
SpendingType spendType = null;
long spendingTypeId = 0l;
if(Validator.isNotNull(TypeId)) spendingTypeId = Long.parseLong(TypeId);
if(!isAddType && spendingTypeId > 0 ){
	
	try{
		spendType = SpendingTypeLocalServiceUtil.getSpendingType(spendingTypeId);
	}catch(Exception e){
		
	}
}

%><%= TypeId%>--<%= spendingTypeId%>

<portlet:actionURL name="spendingType" var="addSpendType"/>
<aui:a href="<%=tab1URL.toString() %>">&lt;back</aui:a>
<aui:layout>
<aui:form name="spendingType" action="<%=addSpendType.toString() %>"  method="post">
	<aui:column>
		<aui:input name="spendingTypeName" label="Spending Type Name" value='<%= Validator.isNotNull(spendType)?spendType.getSpendingName(locale):""%>' type="text"></aui:input>
		<aui:input name="spendingTypeDesc" label="Spending Type Desc" value='<%=Validator.isNotNull(spendType)?spendType.getDescription(locale):""%>' type="textarea"></aui:input>
		<c:if test="<%=(!isAddType && spendingTypeId > 0) %>">
		  <aui:input name="edit" value="<%=spendType.getSpendingId() %>" type="hidden"/>
		</c:if>
		<aui:button-row>
		  <aui:button name="cancel" type="button" value="Cancel" onClick="<%=tab1URL.toString() %>"></aui:button>
		  <aui:button name="submit" type="submit" value="Add" ></aui:button>
		</aui:button-row>
	</aui:column>
</aui:form>
</aui:layout>